package map;

import java.util.*;

/**
 * Map体现的结构是一个多行两列的表格，其中左列成为key，优劣称为value
 */
public class MapDemo1 {
    public static void main(String[] args) {
        Map<String, Integer> map = new HashMap<>();
        Integer value = map.put("化学", 99);
        System.out.println(value);
        map.put("语文", 100);
        map.put("数学", 90);
        map.put("英语", 90);
        System.out.println(map);
        value = map.put("化学", 30);
        System.out.println(value);
        System.out.println(map);


        value = map.get("化学");
        System.out.println(value);
        value = map.get("音乐");
        System.out.println(value);

        int size = map.size();
        System.out.println("size:" + size);

        value = map.remove("语文");
        System.out.println(value);
        System.out.println(map);

        boolean isEmpty = map.isEmpty();
        System.out.println("是否为空:" + isEmpty);

        boolean ck = map.containsKey("化学");
        System.out.println(ck);
        ck= map.containsKey("语文");
        System.out.println(ck);
        boolean cv = map.containsValue(90);
        System.out.println(cv);
        cv = map.containsValue(110);
        System.out.println(cv);

        map.clear();
        System.out.println(map);

    }
}
